set the member of sprite the changeSprite of me to member the DownCM of me
set the loc of sprite the changeSprite of me to point(320, 240)
set the button_active of me to 1
end
on mouseUp me
if the button_active of me then
set the loc of sprite the changeSprite of me to point(-4444, -4444)
set the button_active of me to 0
call(runScript, script scriptLoc)
end if
end
on mouseEnter me
if the button_active of me then
set the loc of sprite the changeSprite of me to point(320, 240)
end if
end
on mouseLeave me
if the button_active of me then
set the loc of sprite the changeSprite of me to point(-4444, -4444)
end if
end
on mouseUpOutSide me
set the button_active of me to 0
end
on beginSprite me
set the UpCM of me to the member of sprite the spriteNum of me
set the UpNum of me to the number of member UpCM
set the DownNum of me to the number of member DownCM
set the button_active of me to 0
end
on endSprite me
end
on getPropertyDescriptionList
if the currentSpriteNum = 0 then
set memdefault to 0
else
set memref to the member of sprite the currentSpriteNum
set memName to the name of member memref
set downName to memName && "dn"
set castLibNum to the castLibNum of memref
set memdefault to member downName of castLib castLibNum
end if
set p_list to [#DownCM: [#comment: "Hilite Image:", #format: #graphic, #default: memdefault], #changeSprite: [#comment: "The other sprite to change:", #format: #integer, #default: 120], #runScript: [#comment: "Handler to activate:", #format: #symbol, #default: #empty], #scriptLoc: [#comment: "Which is in member:", #format: #script, #default: EMPTY]]
return p_list
end
on getBehaviorDescription
return "Makes a sprite work as a pushbutton with automatic highlighting and mouse tracking. The sprite's initial castmember represents the button's normal state." & RETURN & "PARAMETERS:" & RETURN & "• Hilite Image - Member to display when the button is pressed. The default is the same name followed by a SPACE and dn" & RETURN & "• The sprite channel that shows the down state." & RETURN & "-- Activates a different sprite to change for the down state, sending it to the center of the stage." & RETURN & "• The script to run and its cast member location, so it's compiled with the behavior."